//
//  POSApplyListCell.m
//  NewPro
//
//  Created by 何荧红 on 2019/5/6.
//  Copyright © 2019 何荧红. All rights reserved.
//

#import "POSApplyListCell.h"

@interface POSApplyListCell ()
@property (weak, nonatomic) IBOutlet UILabel *name;
@property (weak, nonatomic) IBOutlet UILabel *time;
@property (weak, nonatomic) IBOutlet UILabel *SNState;
@property (weak, nonatomic) IBOutlet UILabel *SnNumber;

@end

@implementation POSApplyListCell

- (void)setModel:(POSApplyListModel *)model{
    _model = model;
    if (_model) {
        self.name.text = _model.merchantName;
        NSTimeInterval interval =[_model.gmtCreate doubleValue] / 1000.0;
        NSDate *date = [NSDate dateWithTimeIntervalSince1970:interval];
        NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
        [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
        NSString *dateString = [formatter stringFromDate: date];
        self.time.text = dateString;
        self.SNState.textColor = [UIColor colorWithHexString:@"0CA6F0"];
        if ([_model.isPassed isEqualToString:@""]) {
            self.SNState.text = @"未提交";
        }
        if ([_model.isPassed isEqualToString:@"0"]) {
            self.SNState.text = @"未提交";
        }
        if ([_model.isPassed isEqualToString:@"1"]) {
            self.SNState.text = @"未提交";
        }
        if ([_model.isPassed isEqualToString:@"2"]) {
            self.SNState.text = @"审核中";
        }
        if ([_model.isPassed isEqualToString:@"3"]) {
            self.SNState.textColor = [UIColor colorWithHexString:@"FF2C2C"];
            self.SNState.text = @"审核失败";
        }
        if ([_model.isPassed isEqualToString:@"4"]) {
            self.SNState.text = @"已开通";
        }
        if ([_model.isPassed isEqualToString:@"5"]) {
            self.SNState.text = @"已激活";
        }
        if ([_model.isPassed isEqualToString:@"6"]) {
            self.SNState.text = @"已达标";
        }
        self.SnNumber.text = _model.posInstanceSn;
    }
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
@end
